package com.cordershy.controller;

import com.cordershy.pojo.user;
import com.cordershy.service.userService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class userController {
    @Autowired
    userService userService;
    @RequestMapping("/user/selectAll")
    public List<user> selectAll(){
        return userService.selectAll();
    }
    @RequestMapping("/user/select")
    public user select(int userid){
        return userService.selectById(userid);
    }
    @RequestMapping("/user/addUser")
    public String insert(user user){
        userService.insert(user);
        return "success";
    }
    @RequestMapping("/user/updateUser")
    public String update(user user){
        userService.update(user);
        return "success";
    }
    @RequestMapping("/user/deleteUser")
    public String delete(int userid){
        userService.delete(userid);
        return "success";
    }
}
